let http = require("http");
let https = require("https");

let server = http.createServer();

server.on("request",(req,res)=>{

    res.writeHead(200, { "Content-Type": "text/plain;charset=utf-8" });
    res.end("111");

    // get获取数据的过程
    let data ="";
    https.get("https://baike.baidu.com/api/wikiui/sharecounter?lemmaId=22623888&method=get",(res)=>{
        // 数据流一块一块返回
        res.on("data",(chunk)=>{
            data += chunk;
        })
        res.on("end",()=>{
            console.log(data);
        })
    })
})

server.listen(3000,()=>{
    console.log("3000 port");
})